package com.njwb.day14.dao.swing;

import com.njwb.day14.dao.StudentDao;
import com.njwb.day14.dao.impl.StudentDaoImpl;
import com.njwb.day14.dao.pojo.Student;

import java.sql.SQLException;
import java.util.List;

public class StudentService {
    private final StudentDao dao = new StudentDaoImpl();

    public boolean login(String username, String password) throws SQLException {
        return dao.logn(username, password);
    }

    public List<Student> getAllStudents() throws SQLException {
        return dao.queryAllStudents();
    }

    public int addStudent(Student stu) throws SQLException {
        return dao.addStudent(stu);
    }

    public int updateStudent(Student stu) throws SQLException {
        return dao.updateStudent(stu);
    }

    public int deleteStudent(int sid) throws SQLException {
        return dao.deleteStudentById(sid);
    }
    public Student findStudentByName(String name) throws SQLException {
        return dao.findStudentByName(name);
    }

}
